<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>狂神说</title>
    <!--1.导入vue.js-->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>

</head>
<body>

<div id="app">
    <button v-on:click="sayHi">click Me</button>
</div>

<script>
    let app = new Vue({
        el: '#app',
        data: {
            message: "狂神说Java"
        },
        methods: {
            //所有方法定义在methods里面
            sayHi: function (){
                alert(this.message);
            }
        }
    });
</script>

</body>
</html>